# 打开文件，准备读取
fr = open('/Users/zhangguoqiang/PycharmProjects/pythonProject/fileDaemon/bill.txt', 'r', encoding="UTF-8")

#打开文件，准备写入
fw = open('/Users/zhangguoqiang/PycharmProjects/pythonProject/fileDaemon/bill.txt.bak', 'w', encoding="UTF-8")

for line in fr:
    line = line.strip()
    if line.split(",")[4] == "测试":
        continue    # continue进入下一次循环，这一次后面的内容就跳过

    # 将内容写出去
    fw.write(line)

    # 由于前面对内容进行了strip()的操作，所以要手动的写出换行符
    fw.write("\n")


# close2个文件对象
fr.close()
fw.close()
